#include<iostream>
#include<string>
using namespace std;
string s;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> s;
		int ans1 = 0, ans2 = 0;
		for (int i = 0; i < s.size() - 1; i++) {
			if (s[i] == 'N') {
				if (s[i + 1] == 'E') {
					ans1++;
				}
				else if (s[i + 1] == 'W') {
					ans2++;
				}
			}
			else if (s[i] == 'E') {
				if (s[i + 1] == 'S') {
					ans1++;
				}
				else if (s[i + 1] == 'N') {
					ans2++;
				}
			}
			else if (s[i] == 'S') {
				if (s[i + 1] == 'W') {
					ans1++;
				}
				else if (s[i + 1] == 'E') {
					ans2++;
				}
			}
			else {
				if (s[i + 1] == 'N') {
					ans1++;
				}
				else if (s[i + 1] == 'S') {
					ans2++;
				}
			}
		}
		if (ans1 > ans2) {
			cout << "CW" << endl;
		}
		else {
			cout << "CCW" << endl;
		}
	}
	return 0;
}